<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app"></div>
<script src="js/react.development.js"></script>
<script src="js/react-dom.development.js"></script>
<!--Babel-->
<script src="js/babel.min.js"></script>

<script type="text/jsx">
    const app = document.getElementById("app")

    function Header({ title }) {
        return <h1>{title ? title : "Default title"}</h1>
    }

    function HomePage() {
        const names = ["Ada Lovelace", "Grace Hopper", "Margaret Hamilton"]

        const [likes, setLikes] = React.useState(0)

        function handleClick() {
            setLikes(likes + 1)
        }

        return (
            <div>
                <Header title="Develop. Preview. Ship." />
                <ul>
                    {names.map((name) => (
                        <li key={name}>{name}</li>
                    ))}
                </ul>

                <button onClick={handleClick}>Like ({likes})</button>
            </div>
        )
    }

    const root = ReactDOM.createRoot(app);
    root.render(<HomePage />);

</script>
</body>
</html>
